package com.black.utils.command;

import java.util.List;
import java.util.stream.Collectors;

/**
 * @author ylx
 */
public class WindowsLocalCmdExecutor extends CmdExecutor
{
    @Override
    public String pwd()
    {
        return execute("pwd").stream().collect(Collectors.joining(System.lineSeparator()));
    }

    @Override
    public List<String> ls()
    {
        return execute("dir");
    }

    @Override
    public List<String> ls(String path)
    {
        return execute("dir " + path);
    }

    @Override
    public List<String> ll()
    {
        return ls();
    }

    @Override
    public List<String> ll(String path)
    {
        return ls(path);
    }

    @Override
    public boolean cd(String path)
    {
        return exec(path);
    }

    @Override
    public boolean mv(String source, String target)
    {
        return exec("move " + source + " " + target);
    }

    @Override
    public boolean rename(String source, String target)
    {
        return exec("rename " + source + " " + target);
    }

    @Override
    public boolean rm(String path)
    {
        return exec("del /F" + path);
    }

    @Override
    public boolean rmdir(String path)
    {
        return exec("rmdir /S /Q" + path);
    }

    @Override
    public boolean mkdir(String path)
    {
        return exec("mkdir " + path);
    }

    @Override
    public boolean mkdirs(String path)
    {
        return mkdir(path);
    }

    @Override
    public String ip()
    {
        return execute("ipconfig").stream().collect(Collectors.joining(System.lineSeparator()));
    }

    @Override
    public boolean exec(String... cmd)
    {
        return false;
    }

    @Override
    public boolean exec(String cmd)
    {
        return false;
    }

    @Override
    public List<String> execute(String cmd)
    {
        return null;
    }
}
